import os
from archive.Book import Book
from archive.FunctionSet import DetermineFunction
from PIL import Image, ImageTk

class Comic:
    """
    title = string
    author = string
    added_date = date
    modified_date = date
    read_date = date
    complete = boolean
    
    image = image data
    books = Book[]
    """
    
    
    def __init__(self, path, stat):
        self.title = ''
        self.author = ''
        self.added_date = ''
        self.modified_date = ''
        self.read_date = ''
        self.complete = False
        self.image = ''
        self.Books = []        
        self.title = os.path.basename(path)
        
        for item in os.listdir(path):
            item_path = os.path.join(path, item)                    
            if DetermineFunction.PathisBook(item_path):
                self.Books.append(Book(item_path, os.stat(item_path)))            
        pass
    def _set_image(self, path):
        
        pass
    
    def GetInfoByDic(self):
        return {'Title': self.title, 'Author': self.author, 'Added date': self.added_date, 'Modified date': self.modified_date, 'Read date': self.read_date, 'Complete': self.complete, 'Image': self.image, 'Books': self.Books, 'self': self}
    